/** layuiAdmin.pro-v1.2.1 LPPL License By http://www.layui.com/admin/ */
;
layui.define(["table", "form"],
function(e) {
    var $ = layui.$,
    i = (layui.$, layui.admin),
    t = layui.view,
    l = layui.table,
    r = layui.form;
    l.render({
        elem: "#LAY-video-manage",
        url: layui.setter.baseUrl+"video/index",
        cols: [[{
            type: "checkbox",
            fixed: "left"
        },
        {
            field: "id",
            width: 100,
            title: "编号ID",
            sort: !0
        },
        {
            field: "nickname",
            title: "用户"
        },
        {
            field: "title",
            title: "活动名称"
        },
        {
            field: "poi_name",
            title: "商户地址"
        },
        {
            field: "mobile",
            title: "商户手机"
        },
        {
            field: "avg_play_duration",
            title: "平均播放时长"
        },
        {
            field: "total_comment",
            title: "评论数"
        },
        {
            field: "total_like",
            title: "点赞数"
        },
        {
            field: "total_play",
            title: "播放数"
        },
        {
            field: "total_share",
            title: "分享数"
        },
        {
            field: "updatetime",
            title: "同步时间",
            templet: "#time2Tpl"
        },
        {
            field: "createtime",
            title: "创建时间",
            templet: "#timeTpl"
        },
        {
            field: "status",
            title: "状态",
            templet: "#vstatusTpl"
        },
        {
            title: "操作",
            width: 160,
            align: "center",
            fixed: "right",
            toolbar: "#table-video-webuser"
        }]],
        page: !0,
        limit: 30,
        text: {
            none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
        }
    }),
    l.on("tool(LAY-video-manage)",
    function(e) {
        var l = e.data;
        if("del" === e.event){
            layer.confirm("确定删除吗？",function(i) {
                $.post(
                    layui.setter.baseUrl+'video/del',
                    {id: l.id},
                    function(ret){
                        var {code,msg,data} = ret;
                        layer.alert(msg);
                        if(code==0){
                            layui.table.reload('LAY-video-manage');
                        }
                    }
                );
            })
        }
        if("update" === e.event){
          $.post(
            layui.setter.baseUrl+'video/getdata',
            {id: l.id},
            function(){
                layer.msg('更新成功');
                layui.table.reload('LAY-video-manage');
            }
          );
        }
    }),
    e("video", {})
});